<?session_start();?>
<html>
	<head>
	<script type="text/javascript" src="jquery.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.8rc2.custom.min.js"></script>
	<link type="text/css" href="css/redmond/jquery-ui-1.8rc2.custom.css" rel="stylesheet" />	
	<link type="text/css" href="css/date.css" rel="stylesheet" />	
	<script type="text/javascript">
	var details;
	function sendPayment(){
		amount=$("#amount").val();
		unit=$("#unit").val();
		mode=$("#mode").val();
		date_received=$("#date_received").val();
		receipt_no=$("#receipt_no").val();
		$("#addPaymentForm").html("<img src='gifs/indicator.gif' />");
		
		$.post('controllers/AddPaymentController.php',{
		unit: unit,
		amount: amount, 
		mode: mode, 
		date_received: date_received, 
		receipt_no: receipt_no, 
		}, function(data) {
		  details=data;
			displayPaymentDetails();
		});
	}
	function displayPaymentDetails(){
		$("#addPaymentForm").html(details);
	}
	
	$(function() {
		var units = [
		"A1","A2","A3","A4","A5","A6","A7","A8","A9",
		"B1","B2","B3","B4","B5","B6","B7","B8","B9",
		"C1","C2","C3","C4","C5","C6","C7","C8","C9",
		"D1","D2","D3","D4","D5","D6","D7","D8","D9",
		"E1","E2","E3","E4","E5","E6","E7","E8","E9",
		"F1","F2","F3","F4","F5","F6","F7","F8","F9",
		"G1","G2","G3","G4","G5","G6","G7","G8","G9",
		"H1","H2","H3","H4","H5","H6","H7","H8","H9"
		];
		$("#unit").autocomplete({
			source: units
		});
	});

	</script>
	
	</head>
	<body>
		<div id="addPaymentForm">
		<h2>Add Payment</h2>
				Unit: <input type="text" id="unit" value="<?php echo $_REQUEST['unit']; ?>"/><br />
				Amount: <input type="text" id="amount" /><br />
				Mode of Payment: 
				<select id="mode">
					<option>Bank</option>
					<option>Personal</option>
				</select><br />
				Date Received: <input type="text" id="date_received" /><br />
								 <script type="text/javascript">
					$(function() {
						$("#date_received").datepicker({ dateFormat: 'yy-mm-dd' });
					});
				</script>
				Receipt Number (if applicable): <input type="text" id="receipt_no" /><br />
				<input type="button" value="Send Request" onclick="sendPayment();return false;" />
		</div>
	</body>
</html>